import { computed } from 'vue'
import { useRoute } from 'vue-router'

export function usePageMeta() {
  const route = useRoute()

  const pageTitle = computed(() => {
    const title = route.meta.pageTitle
    return typeof title === 'string' && title.trim() ? title : ''
  })

  const pageSubtitle = computed(() => {
    const subtitle = route.meta.pageSubtitle
    return typeof subtitle === 'string' && subtitle.trim() ? subtitle : ''
  })

  return {
    pageTitle,
    pageSubtitle
  }
}
